package top.buyibuyi.course.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.buyibuyi.course.R;
import top.buyibuyi.course.pojo.Admin;
import top.buyibuyi.course.service.SelectTeaterService;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/course")
public class SelectTeaterController {
    @Autowired
    private SelectTeaterService selectTeaterService;

    @GetMapping("/selectTeacher")
    private R selectTeacher(){
        try {
            List<Admin> admins = selectTeaterService.selectTeacher();
            System.out.println(admins);
            return R.ok().data("data",admins);
        }catch (Exception e){
            e.printStackTrace();
            return R.error();
        }
    }
}
